Image generation method, image generation apparatus, and image generation program

ABSTRACT

Embodiments are directed to accurately measuring a distance between a “true probability distribution: q” and a “probability distribution determined from a model of a generator: p” by D(x,y) of cGANs, so that a generated image may be made closer to a true image. A method of generating an image by using a conditional generative adversarial network constituted by two neural networks which are a generator and a discriminator, in which the discriminator outputs a result obtained from an arithmetic operation using a model of the following equation:f(x, y; θ):=f1 (x, y; θ)+f2(x; θ)=yTV ϕθΦ(x)+ψθΨ (ϕθΦ (x))

TECHNICAL FIELD

Embodiments of the described invention relate to an image generating method, an image generating device, and an image generating program.

BACKGROUND

As a technique using a deep layer neural network (hereinafter, also referred to as deep learning), various techniques such as an object recognition technique, an object detection technique, a segmentation technique (a technique for classification on an image at the pixel level), and an image caption technique are known.

Furthermore, research on “allow a picture to be drawn” by using deep learning has also recently attracted attention. For example, there is known a technology of using two images, a “contents image” and a “style image” so as to specify that a drawing style of the “style image” is applied to the “contents image” so that a new image is generated (Non Patent Literature 1). Apart from the research in which a new image is generated by using two images, the “contents image” and the “style image,” research has also been performed in which, when a new image is generated, the new image is drawn without requiring any image. As a method of drawing a new image without requiring any image, a method such as generative adversarial networks (hereinafter, GANs) is disclosed (Non Patent Literature 2).

In the GANs, a generative model is created by causing two neural networks to perform learning These two neural networks are called a generator and a discriminator (hereinafter, the discriminator, also referred to as D(x)), and are in a competitive relationship. In schematic explanation, first, a generator generates data x from random numbers z. In the GANs, data x are concurrently generated from two sources, and the data x follow either a “probability distribution of true data” or a “probability distribution generated by the generator.” The discriminator learns to distinguish the “data x generated by the generator” from the “true data x.” In contrast, the generator learns to generate data that may not be distinguishable from the true data by the discriminator. As learning continues in this manner, the data generated by the generator is made closer to the true data so as to finally generate an image at such a level that the image may be mistaken for a real one. More specifically, the role of D(x) in the GANs is to measure a distance or a divergence between a “true probability distribution: q” and a “probability distribution determined from a model of the generator: p.” The generator learns to reduce the distance or the divergence measured by the discriminator by proxy. With respect to the GANs, a research is being conducted on not only a new image generation, but also a method of improving a resolution of an image with a reduced resolution by processing the image with the GANs (hereinafter, super-resolution).

As one of models of GANs, there exist conditional GANs (hereinafter, cGANs) (Non Patent Literature 3). In the GANs, as described above, D(x) receives x and determines whether x follows a “probability distribution of true data” or a “probability distribution generated by a generator.” Whereas a discriminator (hereinafter, also referred to as D(x,y)) in the cGANs receives condition information y as well as x, and determines whether x follows a “probability distribution of true data” or a “probability distribution generated by a generator.” As the condition information y, for example, information such as category information is used. Research on the use of these cGANs in, for example, class-condition generation (Non Patent Literature 4) or image generation from a text (Non Patent Literature 5) is also disclosed.

In the conventional cGANs, as illustrated in FIG. 1, a method of concatenating y when x is input to D(x,y), or as illustrated in FIG. 2, a method of providing an intermediate layer and concatenating y to the intermediate layer has been employed. However, when these conventional methods are used, in many cases, a distance between a “true probability distribution: q” and a “probability distribution determined from a model of a generator: p” may not be accurately measured by D(x,y). Thus, it is not possible to bring the generated image closer to such a level that the image is mistaken for a true image.

CITATION LIST FOR NON PATENT LITERATURE

Non Patent Literature 1: Neural Algorithm of Artistic Style. arXiv:1508.0657

Non Patent Literature 2: Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks. arXiv:1511.06434

Non Patent Literature 3: Conditional Generative Adversarial Nets. arXiv:1411.1784

Non Patent Literature 4: Proceedings of the 34th International Conference on Machine Learning, PMLR 70:2642-2651, 2017

Non Patent Literature 5: Generative Adversarial Text to Image Synthesis. arXiv:1605.05396

SUMMARY OF EMBODIMENTS

An object of the described embodiments is to solve the above described problem in a model of conventional cGANs, and to provide a way of accurately measuring a distance between a “true probability distribution: q” and a “probability distribution determined from a model of a generator: p” by D(x,y), so that a generated image may be made closer to a true image. One embodiment comprises a method of training a conditional generative adversarial network, wherein, the conditional generative adversarial network comprising a generator and a discriminator; and the discriminator outputs a result obtained using the following equation:

f(x, y; θ):=f ₁(x,y; θ)+f ₂(x; θ)=y ^(T) V ϕ _(θ) _(Φ) (x)+ψ_(θ) _(Ψ) (ϕ_(θ) _(Φ) (x))

Intensive research was undertaken in order to solve the above problem, and it was found that it is possible to accurately measure a distance between a “true probability distribution: q” and a “probability distribution determined from a model of a generator: p” by using a specific model of D(x,y) so that a generated image may be made closer to a true image, thereby implementing certain embodiments.

Embodiments are so described as follows.

-   -   [1] A method of generating an image, including using a         conditional generative adversarial network constituted by two         neural networks which are a generator and a discriminator,         wherein the discriminator outputs a result obtained from an         arithmetic operation using a model of the equation (11) shown         below     -   [2] The image generating method described in [1], wherein         one-hot-encoded data is used as category data y in the         equation (11) shown below.     -   [3] An image generating device incorporating a conditional         generative adversarial network constituted by two neural         networks which are a generator, and a discriminator, wherein the         discriminator has an arithmetic unit that performs an arithmetic         operation using a model of the equation (11) shown below.     -   [4] The image generating device described in [3], wherein         category data y in the following equation (11) is         one-hot-encoded data.     -   [5] An image generating program causing a computer to execute         the image generating method described in [1] or [2].

According to some embodiments, at the time of image generation using cGANs, it is possible to accurately measure a distance between a “true probability distribution: q” and a “probability distribution determined from a model of a generator: p” by D(x,y), so that a generated image may be made closer to a true image.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is an explanatory view of a discriminator model (concat) in a conventional technology;

FIG. 2 is an explanatory view of a discriminator model (concat) with an intermediate layer in the conventional technology;

FIG. 3 is an explanatory view of a discriminator model (multiply) in some embodiments;

FIG. 4 is a view illustrating learning curves of the conventional technology (concat) and some embodiments (multiply);

FIG. 5 is a view illustrating Intra FIDs plotted for each class;

FIG. 6 is a view illustrating a comparison of generated images in different methods;

FIG. 7 is a view illustrating a comparison of generated images in different methods;

FIG. 8 is a view illustrating Morphing between different classes; and

FIG. 9 is a view illustrating the result of super-resolution.

DETAILED DESCRIPTION Outline

As described above, the role of D(x) in GANs is to measure a distance or divergence between a “true probability distribution: q” and a “probability distribution determined from a model of a generator: p.” Under embodiments of the present invention, assuming that y given x; p(y|x) has a unimodal distribution such as a Gaussian distribution or a discrete distribution that may be represented by a log linear model, there is proposed a model of D(x,y) in cGANs with theoretical motivation in a case where such assumption may be made. In the proposed model, considering that an optimal solution when D(x) is implicitly given becomes a log likelihood ratio, it is possible to consider that first, the log likelihood ratio may be divided into a log likelihood ratio log q(y|x)/p(y|x) with a conditional distribution, and a log likelihood ratio log q(x)/p(x) of x. Next, with regard to the log q(y|x)/p(y|x), it is assumed that each of q(y|x) and p(y|x) has a unimodal distribution such as a Gaussian distribution or a discrete distribution that may be represented by a log linear model, as described above. Then, the resultant model of D(x,y) has a form obtained by multiplying and summing up condition information y by the output of φ, as illustrated in FIG. 3. The cGANs using this new D(x, y) model are greatly improved in performance as compared to the cGANs using a conventional D(x, y) model as illustrated in FIG. 1 or FIG. 2. By applying this new D(x, y) model to a task of super-resolution, it is possible to generate an image that is more discriminative than that in the conventional technology.

Hereinafter, the present invention will be described in detail with respect to an example embodiment, but the present invention is not limited to the following example embodiment.

The loss function of D(x) in the cGANs is expressed by the following equation (1).

(D)=E _(q(y)) [E _(q(x|y)) [A _(q) (D(x, y))]]+E _(p(y)) [E _(pα(x|y)) [A _(p) (D(x, y)]]]   (1)

The following equation (2) is frequently used as the loss function.

(D)=E _(q(y)) [E _(q(x|y)) [softplus(−D(x, y))]]+E _(p(y)) [E _(p(x|y)) [softplus(D(x, y))]]  (2)

The optimum D(x,y) for minimizing a loss in the above equation (2) is expressed by the following equation (3).

$\begin{matrix} {{D^{*}\left( {x,y} \right)} = {{r\left( {x,y} \right)}:={\log\frac{{q\left( x \middle| y \right)}{q(y)}}{{p\left( x \middle| y \right)}{p(y)}}}}} & (3) \end{matrix}$

The above equation (3) may be expressed by the following equation (4).

$\begin{matrix} {{\log\frac{{q\left( x \middle| y \right)}{q(y)}}{{p\left( x \middle| y \right)}{p(y)}}} = {{\log\frac{{q\left( y \middle| x \right)}{q(x)}}{{p\left( y \middle| x \right)}{p(x)}}} = {{{\log\frac{q\left( y \middle| x \right)}{p\left( y \middle| x \right)}} + {\log\frac{q(x)}{p(y)}}} = {{r\left( y \middle| x \right)} + {{r(x)}.}}}}} & (4) \end{matrix}$

In some embodiments, the full log ratio r(y,x), is divided into two log ratios r(y|x) and r(x), and it is assumed that each of q(y|x) and p(y|x) has a unimodal distribution such as a Gaussian distribution or a discrete distribution that may be represented by a log linear model. It is also possible to build f1 for calculating r(y|x) and f2 for calculating r(x), and combine the f1 and f2 with each other so as to create D. In the conventional technology, the model of D(x,y) is represented by D([x,y]) of x and y; [x,y], but the conventional D(x,y) has an excessive flexibility and thus is not desirable in modeling the above equation (3).

Single Categorical Variable Case

In the class-conditional image generation, when it is assumed that a categorical variable is represented by y ∈ {1, . . . , } (C is the number of categories), the most frequently used model of p(y|x) is represented by a log linear model in the following equation (5).

$\begin{matrix} {{{\log\;{p\left( {y = \left. c \middle| x \right.} \right)}}:={{{\omega_{c}^{pT}{\phi^{p}(x)}} - {\log\left( {\sum\limits_{j = 1}^{C}{\exp\left( {\omega_{j}^{pT}{\phi^{p}(x)}} \right)}} \right)}} = {{\omega_{c}^{pT}{\phi^{p}(x)}} - {\log\;{Z\left( {\phi^{p}(x)} \right)}}}}},} & (5) \end{matrix}$

where Z (ϕ^(P)(x)):=(Σ_(j=1) ^(C) exp (w_(j) ^(pT) ϕ^(P) (x))) is the partition function, and ϕ^(P):x

^(d) ^(L) is the input to the layer of the network model.

In this manner, q(y|x) and p(y|x) become the following equation (6) and the following equation (7), respectively.

$\begin{matrix} {{r\left( {y = \left. c \middle| x \right.} \right)} = {\log\frac{q\left( {y = \left. c \middle| x \right.} \right)}{p\left( {y = \left. c \middle| x \right.} \right)}}} & (6) \\ {= {{\omega_{c}^{qT}{\phi^{q}(x)}} - {\omega_{c}^{qT}{\phi^{p}(x)}} - {\left( {{\log\;{Z^{q}\left( {\phi^{q}(x)} \right)}} - {\log\;{Z^{p}\left( {\phi^{p}(x)} \right)}}} \right).}}} & (7) \end{matrix}$

Here, if φ is shared by φq and φp, the above equation (7) becomes the following equation (8) and the following equation (9).

$\begin{matrix} {= {{\omega_{c}^{qT}{\phi(x)}} - {\omega_{c}^{pT}{\phi(x)}} - \left( {{\log\;{Z^{q}\left( {\phi(x)} \right)}} - {\log\;{Z^{p}\left( {\phi(x)} \right)}}} \right)}} & (8) \\ {= {{\left( {\omega_{c}^{q} - \omega_{c}^{p}} \right)^{T}{\phi(x)}} - \left( {{\log\;{Z^{q}\left( {\phi(x)} \right)}} - {\log\;{Z^{p}\left( {\phi(x)} \right)}}} \right)}} & (9) \end{matrix}$

The second term in the above equation does not depend on the label y=c, and thus only the first term has to be modeled in order to execute approximate reasoning on log(q(y|x)/p(y|x)). If {tilde over (w)}_(c):=(w_(c) ^(q)−w_(c) ^(p)) for (w_(c) ^(q), w_(c) ^(p)) as an implicit function, r(y=c|x)={tilde over (w)}_(c)ϕ(x) is obtained. When it is assumed that w is the weight of the final layer of r(x), the discriminator-model of the cGANs is expressed by the following equation (10). In the following equation (10), when one-hot-encoded data is used as y, a model expressed by the following equation (11) is derived.

Equation (10) is as follows:

f(x,y=c):={tilde over (w)} _(c) ^(T) ϕ_(θ)(x)+{tilde over (w)} ^(T) ϕ_(θ)(x)   10)

Equation (11) is as follows:

f(x,y; θ):=f ₁(, y; θ)+f ₂(x; θ)=y ^(T) V ϕ _(θ) _(Φ) (x)+Ψ_(θ) _(Ψ) (ϕ_(θ) _(Φ) (x))   (11)

Here, V is an embedding matrix of y,

ϕ_(θ) _(Φ) is a function that outputs a vector with x as an argument, and ψ_(θ) _(Ψ) is a function that outputs a scalar value with ϕ_(θ) _(Φ) as an argument. θ={V,θ_(Φ), θ_(Ψ)} is a learning parameter, and is a parameter that is used for training for optimizing a hostile loss.

As illustrated in the above equation (11) and FIG. 3, in some embodiments, a model obtained by multiplying and summing up the condition information y by the output of φ is used.

Continuous Variable Case

Let y ∈ R^(d) be denoted as a d-dimensional continuous variable. It is assumed that the true and model distribution of y given x to be Gaussian distributions:

q(y|x)=N(y|μ _(q)(ϕ(x)), Λ_(q) ⁻¹ (ϕ(x)) and p(y|x)=N(y|μ _(p) (ϕ(x)), Λ_(p) ⁻¹(ϕ(x))).

The density ratio r(y|x)=log(q(y|x)/p(y|x)) is given by

Equation 12 as follows:

$\begin{matrix} {{r\left( y \middle| x \right)} = {\log\left( {\sqrt{\frac{\Lambda_{q}}{\Lambda_{p}}}\frac{\exp\left( {{- \left( {1/2} \right)}\left( {y - \mu_{q}} \right)^{T}{\Lambda_{q}\left( {y - \mu_{q}} \right)}} \right)}{\exp\left( {{- \left( {1/2} \right)}\left( {x - \mu_{p}} \right)^{T}{\Lambda_{p}\left( {y - \mu_{p}} \right)}} \right)}} \right)}} & (12) \\ {= {{{- \frac{1}{2}}{y^{T}\left( {\Lambda_{q} - \Lambda_{p}} \right)}y} + {\left( {{\mu_{q}^{T}\Lambda_{q}} - {\mu_{p}^{T}\Lambda_{p}}} \right)y} + {{const}.}}} & (13) \end{matrix}$

where we omit the dependence of x on μ_(q), μ_(p), Λ_(q), Λ_(p) for simplicity. Thus, we now have the guiding principle for Gaussian variable case. The difference of the categorical variable case where the dependence of x on μ_(q), μ_(p), Λ_(q), Λ_(p) is omitted for simplicity. Thus, there is now the guiding principle for the Gaussian variable case. The difference of the categorical variable case is the existence of the second order term y^(T) (Λ_(q)−Λ_(p))y. Λ:=Λ_(q)−Λ_(p) is a symmetric matrix, so it is desirable to parametrize Λ to be always symmetric. If it is assumed Λ_(q) and Λ_(p) are the same, the second order term need not be considered. When the second order is omitted, as a result, the same model as in the above equation (11) can be obtained in a Gaussian variable case as well.

Relation to AC-GANs and Other Auxiliary Loss-Based GANs

AC-GAN (Odena et al., 2016) uses a discriminator D=[D₁, D₂] with the functionality of label classifier (D₂) as well as of the discriminator function in the standard GAN (D₁). AC-GAN, however, incorporates the label information into the objective function simply by augmenting the original discriminator objective with the likelihood function of the classifier on both generated and training dataset:

(D)=V (G′, D ₁)+C(D ₂(x _(data))+C(D ₂(G′(z))),   (14)

(G)=V (G, D′ ₁)+C(D′ ₂(G(z))   (15)

where C represents classification loss. Note that the objective function of this form may un-wittingly encourage the Generator to produce images that are easy for the current D to where C represents classification loss. Note that the objective function of this form may unwittingly encourage the Generator to produce images that are easy for the current D to classify, ultimately resulting in mode collapse. This effect can be seen in experimental sets of images generated by AC-GAN.

EXAMPLES

Two experiments indicating the effectiveness of the discriminator model according to some embodiments were performed. One is a class conditional image generation using an ILSVRC2012 data set (ImageNet), and the other is a super-resolution task using the same data set. For both tasks, a discriminator and a generator used based on ResNet (He et al., 2016b) (Gulrajani et at, 2017) were used. In the objective function of learning, the adversarial loss in the following equation (16) and the following equation (17) was used.

Equation (16) is as follows:

L(Ĝ, D)=E _(q(y)) [E _(q(x|y)) [min (0, −1+D(x,y)]]+E _(p(y)) [E _(p) _(α) _((w|y)) [min(0, −1 −D (x/y))]]  (16)

Equation (17) is as follows:

L(G, {circumflex over (D)})=−E _(p(y)) [E _(p) _(α) _((x|y)) [{circumflex over (D)}(x, y))]]  (17)

In all experiments, an Adam optimizer (Kingma & Ba, 2015) was used. Hyper parameters were set as the same (α=0.0002; β1=0; β2=0.9) as those used in the past experiment, and the number of times the discriminator updates was set to five with respect to the number of times (one) the generator updates.

Class-Conditional Image Generation

In this task, learning of a conditional generative model in a class was performed using an ImageNet dataset. The number of classes is 1,000, and the number of images per class is about 1,300. For the evaluation, the Inception score was used as an index by which advantages of a Visual appearance are measured, and the intra-class MSSSIM, and the intra-class FIDs were used as indices by which a diversity is measured to some extent. Here, in order to see how a performance differs according to the difference of the way of giving a condition, three models, that is, AC-GANs (Odena et al., 2016) as a GANs model of state of the art, hidden concatenation, and proposed multiply, were tried. As illustrated in FIG. 4, it can be found that an embodiment (multiply) is higher in a visual quality.

Table 1 is as follows:

TABLE 1 Various scores on ImageNet. Method AC-GANs (†) AC-GANs Concat Multiply (visual appearance) Inception Score N/A 28.7 23.3 30.3 Inception Acc. 10.1% 48.0 17.6 31.9 (visual diversity) Intra MS-SSIM 0.25 0.94 0.12 0.11 MS-SSIM Acc 84.7% 0% 97.4% 97.1% (both) Average intra FID N/A 252.0 149.2 124.2 (†) Odena et al. (2016)

The above table 1 indicates respective results after completion of training. For the AC-GANs, since the training was collapsed during the training, each evaluation was performed for a model when the inception score was highest.

First, the Visual appearance of an embodiment (multiply) greatly exceeds that of the conventional technology (concat).

As illustrated in FIG. 5, when an embodiment (multiply) is compared to the conventional technology (concat), it can be found that the FIDs are smaller in an embodiment (multiply) in most classes, that is, the wasserstein distance is smaller on a feature space. When AC-GANs are compared to an embodiment (multiply), the visual quality of the AC-GANs exceeds that of an embodiment (multiply), but the value of the Intra-MSSSIM is very high.

As illustrated in FIG. 6, it can be found that the AC-GANs generate easy-to-recognize samples, but generate only a single type of samples, which becomes a result far from a generative model. For the Intra-FID scores, overall, the values of an embodiment (multiply) are low. This is because according to the second order term of a FID, the FID value in a class with no diversity consequentially increases.

No Obvious Collapse by Multiply Method

As illustrated in FIG. 7, in the model learned by the method of an embodiment (multiply), a class being collapsed was not recognized. In the model learned by the method of the conventional technology (concat), a plurality of classes clearly being collapsed were present.

Class Morphing

FIG. 8 illustrates a view when morphing was performed between different classes with z fixed. It can be found out that morphing is smoothly performed even between completely different classes.

In formulation, when a low resolution RGB image x^(LR) ∈

^(R) ^(L) ^(×R) ^(L) ^(×3) is given, a task of learning a distribution p(x^(H R)|x^(L R)) of an image x^(H R) ∈

^(R) ^(S) ^(×R) _(S) ^(×3), H>L with super-resolution is performed. Here, p(x^(H R)|x^(L R)) has a multi-modal distribution whereas inversed p(x_(LR)|x_(HR)) not only depends on a process in which a low resolution image is obtained but also may have a unimodal distribution such as a Gaussian distribution. In this task, a discriminator is defined as follows:

$\begin{matrix} {{{f\left( {x^{HR},x^{LR}} \right)} = {{\sum\limits_{i,j,k}\left( {{x_{ijk}^{LR}{R_{ijk}^{(1)}\left( {\phi\left( x^{HR} \right)} \right)}} + {R_{ijk}^{(2)}\left( {\phi\left( x^{HR} \right)} \right)}} \right)} + {R^{(3)}\left( {\phi\left( x^{HR} \right)} \right)}}}\mspace{20mu}{where}\mspace{20mu}{{{R^{(1)}\left( {\phi\left( x^{HR} \right)} \right)} = {W^{r_{1}}*\phi\left( x^{HR} \right)}},\mspace{20mu}{{R^{(2)}\left( {\phi\left( x^{HR} \right)} \right)} = {W^{r_{2}}*\phi\left( x^{HR} \right)}},\mspace{20mu}{R^{(3)}\left( {{\phi\left( x^{HR} \right)} = {{g\left( {\phi\left( x^{HR} \right)} \right)}.}} \right.}}} & (18) \end{matrix}$

As illustrated in FIG. 9, the super-resolution by Bicubic is blurred. The super-resolution by the method of the conventional technology (concat) becomes clear to some extent, but low-resolution jagged patterns remain, which makes it difficult to successfully perform learning. 

1-6. (canceled)
 7. A model training device comprising: at least one memory; and at least one processor configured to: provide at least one of (1) first data generated by a generator or (2) training data to a first neural network included in a discriminator, calculate a first scalar value based on a product between an output of the first neural network and condition information, calculate a loss based on the first scalar value, and update, based on the loss, at least one of the discriminator or the generator.
 8. The device according to claim 7, wherein the condition information is represented by a one-hot vector.
 9. The device according to claim 8, wherein the one-hot vector includes category information.
 10. The device according to claim 7, wherein the at least one processor is further configured to: calculate a second scalar value by providing the output of the first neural network to a second neural network included in the discriminator, and calculate the loss based on the first scalar value and the second scalar value.
 11. The device according to claim 10, wherein the at least one processor is further configured to calculate the loss by adding the first scalar value and the second scalar value.
 12. The device according to claim 7, wherein the first data generated by the generator is image data.
 13. The device according to claim 7, wherein the at least one processor is further configured to input noise to the generator to generate the first data.
 14. A data generation device comprising: at least one memory; and at least one processor configured to: generate data by inputting noise to a generator trained by the device according to claim
 7. 15. A model training method comprising: providing, by at least one processor, at least one of (1) first data generated by a generator or (2) training data to a first neural network included in a discriminator, calculating, by the at least one processor, a first scalar value based on a product between an output of the first neural network and condition information, calculating, by the at least one processor, a loss based on the first scalar value, and updating, by the at least one processor, at least one of the discriminator or the generator based on the loss.
 16. The method according to claim 15, wherein the condition information is represented by a one-hot vector.
 17. The method according to claim 16, wherein the one-hot vector includes category information.
 18. The method according to claim 15, further comprising: calculating, by the at least one processor, a second scalar value by providing the output of the first neural network to a second neural network included in the discriminator, wherein calculating the loss includes calculating the loss based on the first scalar value and the second scalar value.
 19. The method according to claim 18, wherein calculating the loss includes calculating the loss by adding the first scalar value and the second scalar value.
 20. The method according to claim 15, wherein the first data generated by the generator is image data.
 21. The method according to claim 15, further comprising: inputting, by the at least one processor, noise to the generator to generate the first data.
 22. A data generating method comprising: generating, by at least one processor, data by inputting noise to a generator trained by the method according to claim
 15. 23. A non-transitory computer readable medium storing a program configured to cause at least one computer to execute a method comprising: providing at least one of (1) data generated by a generator or (2) training data to a first neural network included in a discriminator, calculating a first scalar value based on a product between an output of the first neural network and condition information, calculating a loss based on the first scalar value, and updating at least one of the discriminator or the generator, based on the loss.
 24. The non-transitory computer readable medium according to claim 23, wherein the condition information is represented by a one-hot vector.
 25. The non-transitory computer readable medium according to claim 24, wherein the one-hot vector includes category information.
 26. The non-transitory computer readable medium according to claim 23, wherein the method further comprises: calculating a second scalar value by providing the output of the first neural network to a second neural network included in the discriminator, wherein calculating the loss includes calculating the loss based on the first scalar value and the second scalar value. 